/*
 * @Author: '421666927@qq.com' '421666927@qq.com'
 * @Date: 2024-08-07 20:14:20
 * @LastEditors: '421666927@qq.com' '421666927@qq.com'
 * @LastEditTime: 2024-08-08 11:38:09
 * @FilePath: \yy-screen-adapter\vite.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import {resolve} from 'path'
import dts from 'vite-plugin-dts'
 
// https://vitejs.dev/config/
export default defineConfig({
  build:{
    lib:{
      entry:resolve(__dirname, './src/components/ScreenAdapter/index.tsx'),
      name: 'ScreenAdapter',
      // formats: ['es'],
      fileName: (format) => `index.${format}.js`
    },
    // lib: {
    //   entry: resolve(__dirname, 'src/components/index.ts'),
    //   name: 'MyLib',
    //   formats: ['es'],
    //   fileName: 'my-lib'
    // },
    rollupOptions:{
      external:['react', 'react-dom'],
      output:{
        globals:{
          react:"React",
          "react-dom":"ReactDom",
        },
      },
    },
    sourcemap:true,
    emptyOutDir:true,
  },
  plugins: [react(), dts()],
})


